# -*- coding: utf-8 -*-
# @Time    : 2022/7/16 20:07
# @Author  : feng
# @Email   : feng@163.com
# @File    : search_page.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from pages.login_page import LoginPage
from pages.base_page import BasePage
from selenium.webdriver.support.select import Select
from time import sleep

class SearchPage(BasePage):
    '''进入商机页面'''
    url='http://192.168.1.5:8081/crm/index.php?m=business'
    '''定位器'''
    sj_locator=(By.LINK_TEXT,'商机')

    sx_locator=(By.XPATH,'//*[@id="field"]')

    bh_locator=(By.ID,'condition')

    sjm_locator=(By.ID,'search')

    ss_locator=(By.CSS_SELECTOR,'#dosearch')




    def click_sj(self):
        self.driver.find_element(*self.sj_locator).click()  #切换到商机页面
        #下拉框选择筛选条件
    def click_sx(self):
        locator=self.driver.find_element(*self.sx_locator)
        sleep(1)
        Select(locator).select_by_index(3)
        #下拉框选择包含
    def click_bh(self):
        locator=self.driver.find_element(*self.bh_locator)
        sleep(1)
        Select(locator).select_by_index(0)
        #输入关键字
    def send_sjm(self,key):
        self.driver.find_element(*self.sjm_locator).send_keys(key)
        #点击搜索
    def click_ss(self):
        self.driver.find_element(*self.ss_locator).click()

